package org.thread.test04.demo02;

/**
 *
 *  @author ZJL
 *  @date 2025-03-11
 */public class MyThread extends Thread {
     private boolean flag = false;
    @Override
    public void run() {
        while (!flag){
            System.out.println("线程一："+Thread.currentThread().getName());
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
    public void stopThread(){
        flag = true;
    }
}
